<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"/>
		<title>Struct RcPtr</title>
		<link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/>
		<link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/>
		<script type="text/javascript" src="../../scripts/jquery.js">/**/</script><script type="text/javascript" src="../../scripts/ddox.js">/**/</script>
	</head>
	<body onload="setupDdox();">
		<nav id="main-nav">
			<noscript>
				<p style="color: red">The search functionality needs JavaScript enabled</p>
			</noscript>
			<div id="symbolSearchPane" style="display: none">
				<form action="#" method="GET">
					<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(40);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/>
				</form>
				<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
$('#symbolSearchPane').show();</script>
			</div>
			<ul class="tree-view">
				<li class="tree-view ">
					<div class="package ">autoptr
					</div>
			<ul class="tree-view">
				<li>
					<div class="module ">
						<a href="../../autoptr/common.html">common</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/intrusive_ptr.html">intrusive_ptr</a>
					</div>
				</li>
				<li>
					<div class="module selected">
						<a href="../../autoptr/rc_ptr.html">rc_ptr</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/shared_ptr.html">shared_ptr</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/unique_ptr.html">unique_ptr</a>
					</div>
				</li>
			</ul>
				</li>
			</ul>
		</nav>
		<div id="main-contents">
			<h1>Struct RcPtr</h1><p><code class="lang-d"><span class="typ">RcPtr</span></code> is a smart pointer that retains shared ownership of an object through a pointer.
</p>
			<div class="prototype">
				<code class="lang-d">
					<div class="single-prototype">
			<span class="kwd">struct</span> <span class="typ">RcPtr</span>(_Type, _DestructorType, _ControlType, <span class="typ">bool</span> _weakPtr<span class="pln"> </span><span class="pun">= </span><span class="kwd">false</span>)
			<br/>
			&nbsp;&nbsp;
			<br/>
			<span class="kwd">if</span> <span class="pun">(</span><span class="pln">isControlBlock</span><span class="pun">!</span><span class="pln">_ControlType </span><span class="pun">&amp;&amp; </span><span class="pln">isDestructorType</span><span class="pun">!</span><span class="pln">_DestructorType</span><span class="pun">);</span>
					</div>
					<div class="single-prototype">
			<span class="kwd">alias</span> <span class="pln">RcPtr</span>(_Type, _ControlType, _DestructorType)
			 <span class="pun">=</span> <a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a>!(_Type,_DestructorType,_ControlType,false)<span class="pun">;</span>
					</div>
				</code>
			</div>
			<section><p>Several <code class="lang-d"><span class="typ">RcPtr</span></code> objects may own the same object.
</p>

<p>    The object is destroyed and its memory deallocated when either of the following happens:
</p>

<p>        1. the last remaining <code class="lang-d"><span class="typ">RcPtr</span></code> owning the object is destroyed.
</p>

<p>        2. the last remaining <code class="lang-d"><span class="typ">RcPtr</span></code> owning the object is assigned another pointer via various methods like <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.opAssign.html"><span class="pln">opAssign</span></a></code> and <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.store.html"><span class="pln">store</span></a></code>.
</p>

<p>    The object is destroyed using destructor of type <code class="lang-d"><span class="pln">_Type</span></code>.
</p>

<p>    A <code class="lang-d"><span class="typ">RcPtr</span></code> can not share ownership of an object while storing a pointer to another object (use <code class="lang-d"><span class="typ">SharedPtr</span></code> for that).
    The stored pointer is the one accessed by <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.get.html"><span class="pln">get</span></a><span class="pun">()</span></code>, the dereference and the comparison operators.
</p>

<p>    A <code class="lang-d"><span class="typ">RcPtr</span></code> may also own no objects, in which case it is called empty.
</p>

<p>    If template parameter <code class="lang-d"><span class="pln">_ControlType</span></code> is <code class="lang-d"><span class="kwd">shared</span></code>  then all member functions (including copy constructor and copy assignment)
    can be called by multiple threads on different instances of <code class="lang-d"><span class="typ">RcPtr</span></code> without additional synchronization even if these instances are copies and share ownership of the same object.
</p>

<p>    If multiple threads of execution access the same <code class="lang-d"><span class="typ">RcPtr</span></code> (<code class="lang-d"><span class="kwd">shared </span><span class="typ">RcPtr</span></code>) then only some methods can be called (<code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.load.html"><span class="pln">load</span></a></code>, <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.store.html"><span class="pln">store</span></a></code>, <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.exchange.html"><span class="pln">exchange</span></a></code>, <code class="lang-d"><span class="pln">compareExchange</span></code>, <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.useCount.html"><span class="pln">useCount</span></a></code>).
</p>

<p>    Template parameters:
</p>

<p>        <code class="lang-d"><span class="pln">_Type</span></code> type of managed object
</p>

<p>        <code class="lang-d"><span class="pln">_DestructorType</span></code> function pointer with attributes of destructor, to get attributes of destructor from type use <code class="lang-d"><a href="../../autoptr/common/DestructorType.html" title="autoptr.common.DestructorType"><span class="typ">DestructorType</span></a><span class="pun">!</span><span class="pln">T</span></code>. Destructor of type <code class="lang-d"><span class="pln">_Type</span></code> must be compatible with <code class="lang-d"><span class="pln">_DestructorType</span></code>
</p>

<p>        <code class="lang-d"><span class="pln">_ControlType</span></code> represent type of counter, must by of type <code class="lang-d"><a href="../../autoptr/common/ControlBlock.html" title="autoptr.common.ControlBlock"><span class="typ">ControlBlock</span></a></code>. if is shared then ref counting is atomic.
</p>

<p>        <code class="lang-d"><span class="pln">_weakPtr</span></code> if <code class="lang-d"><span class="kwd">true</span></code> then <code class="lang-d"><span class="typ">RcPtr</span></code> represent weak ptr
</p>
</section>
<h2>Struct RcPtr</h2>
			<section><h3>Constructors</h3>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.this.html" class="public">
								<code>this</code>
							</a>
							<span class="tableEntryAnnotation">(nil)</span>
						</td>
						<td>Constructs a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> without managed object. Same as <code class="lang-d"><span class="typ">RcPtr<wbr/></span><span class="pun">.</span><span class="pln">init</span></code>
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.this.html" class="public">
								<code>this</code>
							</a>
							<span class="tableEntryAnnotation">(rhs)</span>
						</td>
						<td>Constructs a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> which shares ownership of the object managed by <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.this.html#rhs"><span class="pln">rhs</span></a></code>.
</td>
					</tr>
				</table>
			</section>
			<section><h3>Properties</h3>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Type</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.element.html" class="public property"><code>element</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="typ">ElementReferenceTypeImpl</span>!(inout(ElementType))</code></td><td>Get pointer to managed object of <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> or reference if <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> is reference type (class or interface) or dynamic array
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.expired.html" class="public property"><code>expired</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="typ">bool</span></code></td><td>Equivalent to <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.useCount.html"><span class="pln">useCount</span></a><span class="pun">() == </span><span class="lit">0</span></code> (must be <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.WeakType.html"><span class="typ">RcPtr<wbr/></span><span class="pun">.</span><span class="typ">WeakType</span></a></code>).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.get.html" class="public property"><code>get</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="kwd">inout</span><span class="pun">(</span><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">RcPtr<wbr/></span><span class="pun">.<wbr/></span><span class="typ">ElementType</span></a><span class="pun">)</span></code></td><td>Get reference to managed object of <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> or value if <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> is reference type (class or interface) or dynamic array.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.length.html" class="public property"><code>length</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="pln">size_t</span></code></td><td>Returns length of dynamic array (isDynamicArray!ElementType == true).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.toHash.html" class="public property"><code>toHash</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="pln">size_t</span></code></td><td>Generate hash
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.useCount.html" class="public property"><code>useCount</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="typ">ControlType<wbr/></span><span class="pun">.</span><span class="typ">Shared</span></code></td><td>Returns the number of different <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> instances
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.weakCount.html" class="public property"><code>weakCount</code></a><span class="tableEntryAnnotation">[get]</span>
						</td>
						<td class="typecol"><code class="prettyprint lang-d"><span class="typ">ControlType<wbr/></span><span class="pun">.</span><span class="typ">Weak</span></code></td><td>Returns the number of different <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.WeakType.html"><span class="typ">RcPtr<wbr/></span><span class="pun">.</span><span class="typ">WeakType</span></a></code> instances
</td>
					</tr>
				</table>
			</section>
			<section><h3>Methods</h3>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.alloc.html" class="public">
								<code>alloc</code>
							</a>
							<span class="tableEntryAnnotation">(a, args)</span>
						</td>
						<td>Constructs an object of type <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> and wraps it in a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> using args as the parameter list for the constructor of <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.alloc.html" class="public">
								<code>alloc</code>
							</a>
							<span class="tableEntryAnnotation">(a, n, args)</span>
						</td>
						<td>Constructs an object of array type <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> including its array elements and wraps it in a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.compareExchangeStrong.html" class="public">
								<code>compareExchangeStrong</code>
							</a>
							<span class="tableEntryAnnotation">(expected, desired)</span>
						</td>
						<td>Compares the <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> pointers pointed-to by <code class="lang-d"><span class="kwd">this</span></code> and <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.compareExchangeStrong.html#expected"><span class="pln">expected</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.compareExchangeWeak.html" class="public">
								<code>compareExchangeWeak</code>
							</a>
							<span class="tableEntryAnnotation">(expected, desired)</span>
						</td>
						<td>Same as <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.compareExchangeStrong.html"><span class="pln">compareExchangeStrong</span></a></code> but may fail spuriously.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.exchange.html" class="public">
								<code>exchange</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Stores the non <code class="lang-d"><span class="kwd">shared</span></code> <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> pointer ptr in the <code class="lang-d"><span class="kwd">shared</span><span class="pun">(<a href="../../autoptr/rc_ptr/RcPtr.html"></span><span class="typ">RcPtr</span></a><span class="pun">)</span></code> pointed to by <code class="lang-d"><span class="kwd">this</span></code> and returns the value formerly pointed-to by this, atomically or with mutex.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.load.html" class="public">
								<code>load</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Returns the non <code class="lang-d"><span class="kwd">shared</span></code> <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> pointer pointed-to by <code class="lang-d"><span class="kwd">shared</span></code> <code class="lang-d"><span class="kwd">this</span></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.lock.html" class="public">
								<code>lock</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Creates a new non weak <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> that shares ownership of the managed object (must be <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.WeakType.html"><span class="typ">RcPtr<wbr/></span><span class="pun">.</span><span class="typ">WeakType</span></a></code>).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.make.html" class="public">
								<code>make</code>
							</a>
							<span class="tableEntryAnnotation">(args)</span>
						</td>
						<td>Constructs an object of type <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> and wraps it in a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> using args as the parameter list for the constructor of <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.make.html" class="public">
								<code>make</code>
							</a>
							<span class="tableEntryAnnotation">(n, args)</span>
						</td>
						<td>Constructs an object of array type <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> including its array elements and wraps it in a <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.move.html" class="public">
								<code>move</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Move <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code>
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opAssign.html" class="public">
								<code>opAssign</code>
							</a>
							<span class="tableEntryAnnotation">(nil)</span>
						</td>
						<td>Releases the ownership of the managed object, if any.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opAssign.html" class="public">
								<code>opAssign</code>
							</a>
							<span class="tableEntryAnnotation">(desired)</span>
						</td>
						<td>Shares ownership of the object managed by <code class="lang-d"><span class="pln">rhs</span></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opCast.html" class="public">
								<code>opCast</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Checks if <code class="lang-d"><span class="kwd">this</span></code> stores a non-null pointer, i.e. whether <code class="lang-d"><span class="kwd">this </span><span class="pun">!= </span><span class="kwd">null</span></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opCast.html" class="public">
								<code>opCast</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Cast <code class="lang-d"><span class="kwd">this</span></code> to different type <code class="lang-d"><span class="typ">To</span></code> when <code class="lang-d"><a href="../../autoptr/rc_ptr/isRcPtr.html"><span class="pln">isRcPtr</span></a><span class="pun">!</span><span class="typ">To</span></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opCmp.html" class="public">
								<code>opCmp</code>
							</a>
							<span class="tableEntryAnnotation">(nil)</span>
						</td>
						<td>Operators &lt;, &lt;=, &gt;, &gt;= for <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opEquals.html" class="public">
								<code>opEquals</code>
							</a>
							<span class="tableEntryAnnotation">(nil)</span>
						</td>
						<td>Operator == and != .
            Compare pointers.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.proxySwap.html" class="public">
								<code>proxySwap</code>
							</a>
							<span class="tableEntryAnnotation">(rhs)</span>
						</td>
						<td>Swap <code class="lang-d"><span class="kwd">this</span></code> with <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.proxySwap.html#rhs"><span class="pln">rhs</span></a></code>
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.weak.html" class="public">
								<code>weak</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Returns weak pointer (must have weak counter).
</td>
					</tr>
				</table>
			</section>
			<section><h3>Aliases</h3>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.ControlType.html" class="public">
								<code>ControlType</code>
							</a>
						</td>
						<td>Type of control block.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.DestructorType.html" class="public">
								<code>DestructorType</code>
							</a>
						</td>
						<td>Type of destructor (<code class="lang-d"><span class="typ">void </span><span class="kwd">function</span><span class="pun">(</span><span class="typ">void</span><span class="pun">*)@</span><span class="pln">attributes</span></code>).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.ElementReferenceType.html" class="public">
								<code>ElementReferenceType</code>
							</a>
						</td>
						<td>Same as <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a><span class="pun">*</span></code> or <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.ElementType.html"><span class="typ">ElementType</span></a></code> if is class/interface/slice.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.ElementType.html" class="public">
								<code>ElementType</code>
							</a>
						</td>
						<td>Type of element managed by <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.isLockFree.html" class="public">
								<code>isLockFree</code>
							</a>
						</td>
						<td><code class="lang-d"><span class="kwd">true</span></code> if shared <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> has lock free operations <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.store.html"><span class="pln">store</span></a></code>, <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.load.html"><span class="pln">load</span></a></code>, <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.exchange.html"><span class="pln">exchange</span></a></code>, <code class="lang-d"><span class="pln">compareExchange</span></code>, otherwise 'false'
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.opUnary.html" class="public">
								<code>opUnary</code>
							</a>
						</td>
						<td>Operator *, same as method 'get'.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.SharedType.html" class="public">
								<code>SharedType</code>
							</a>
						</td>
						<td>Type of non weak ptr (must have weak counter).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.store.html" class="public">
								<code>store</code>
							</a>
						</td>
						<td>Stores the non <code class="lang-d"><span class="kwd">shared</span></code> <code class="lang-d"><a href="../../autoptr/rc_ptr/RcPtr.html"><span class="typ">RcPtr</span></a></code> parameter <code class="lang-d"><span class="pln">ptr</span></code> to <code class="lang-d"><span class="kwd">this</span></code>.
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/rc_ptr/RcPtr.WeakType.html" class="public">
								<code>WeakType</code>
							</a>
						</td>
						<td>Weak pointer
</td>
					</tr>
				</table>
			</section><h2>Alias RcPtr</h2>
			<section><h2>Example</h2>

<pre class="code"><code class="lang-d"><span class="pln">
</span><span class="kwd">static class </span><span class="typ">Foo</span><span class="pun">{
    </span><span class="typ">int </span><span class="pln">i</span><span class="pun">;

    </span><span class="kwd">this</span><span class="pun">(</span><span class="typ">int </span><span class="pln">i</span><span class="pun">)</span><span class="kwd">pure nothrow @safe @nogc</span><span class="pun">{
        </span><span class="kwd">this<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">= </span><span class="pln">i</span><span class="pun">;
    }
}

</span><span class="kwd">static class </span><span class="typ">Bar </span><span class="pun">: </span><span class="typ">Foo</span><span class="pun">{
    </span><span class="typ">double </span><span class="pln">d</span><span class="pun">;

    </span><span class="kwd">this</span><span class="pun">(</span><span class="typ">int </span><span class="pln">i</span><span class="pun">, </span><span class="typ">double </span><span class="pln">d</span><span class="pun">)</span><span class="kwd">pure nothrow @safe @nogc</span><span class="pun">{
        </span><span class="kwd">super</span><span class="pun">(</span><span class="pln">i</span><span class="pun">);
        </span><span class="kwd">this<wbr/></span><span class="pun">.</span><span class="pln">d </span><span class="pun">= </span><span class="pln">d</span><span class="pun">;
    }
}

</span><span class="com">//implicit qualifier cast
</span><span class="pun">{
    </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="kwd">const </span><span class="typ">Foo</span><span class="pun">) </span><span class="pln">foo </span><span class="pun">=  </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Foo<wbr/></span><span class="pun">.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">42</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">== </span><span class="lit">42</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);

    </span><span class="kwd">const </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Foo </span><span class="pln">foo2 </span><span class="pun">= </span><span class="pln">foo</span><span class="pun">;
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo2<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">== </span><span class="lit">42</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">2</span><span class="pun">);

}

</span><span class="com">//polymorphic classes:
</span><span class="pun">{
    </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Foo </span><span class="pln">foo </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Bar<wbr/></span><span class="pun">.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">42</span><span class="pun">, </span><span class="lit">3.14</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo </span><span class="pun">!= </span><span class="kwd">null</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">== </span><span class="lit">42</span><span class="pun">);

    </span><span class="com">//dynamic cast:
    </span><span class="pun">{
        </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Bar </span><span class="pln">bar </span><span class="pun">= <a href="../../autoptr/rc_ptr/dynCast.html"></span><span class="pln">dynCast</span></a><span class="pun">!</span><span class="typ">Bar</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">foo<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">2</span><span class="pun">);

        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">bar<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">== </span><span class="lit">42</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">bar<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">d </span><span class="pun">== </span><span class="lit">3.14</span><span class="pun">);
    }

}

</span><span class="com">//weak references:
</span><span class="pun">{
    </span><span class="kwd">auto </span><span class="pln">x </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">double<wbr/></span><span class="pun">.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">3.14</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">weakCount </span><span class="pun">== </span><span class="lit">0</span><span class="pun">);

    </span><span class="kwd">auto </span><span class="pln">w </span><span class="pun">= </span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">weak</span><span class="pun">();  </span><span class="com">//weak pointer
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">weakCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(*</span><span class="pln">w<wbr/></span><span class="pun">.</span><span class="pln">lock </span><span class="pun">== </span><span class="lit">3.14</span><span class="pun">);

    </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">double<wbr/></span><span class="pun">.</span><span class="typ">WeakType </span><span class="pln">w2 </span><span class="pun">= </span><span class="pln">x</span><span class="pun">;
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">useCount </span><span class="pun">== </span><span class="lit">1</span><span class="pun">);
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">x<wbr/></span><span class="pun">.</span><span class="pln">weakCount </span><span class="pun">== </span><span class="lit">2</span><span class="pun">);

    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">w2<wbr/></span><span class="pun">.</span><span class="pln">expired </span><span class="pun">== </span><span class="kwd">false</span><span class="pun">);
    </span><span class="pln">x </span><span class="pun">= </span><span class="kwd">null</span><span class="pun">;
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">w2<wbr/></span><span class="pun">.</span><span class="pln">expired </span><span class="pun">== </span><span class="kwd">true</span><span class="pun">);
}

</span><span class="com">//dynamic array
</span><span class="pun">{
    </span><span class="kwd">import </span><span class="pln">std<wbr/></span><span class="pun">.</span><span class="pln">algorithm </span><span class="pun">: </span><span class="pln">all</span><span class="pun">;

    {
        </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[])<wbr/>.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">10</span><span class="pun">, -</span><span class="lit">1</span><span class="pun">);

        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">length </span><span class="pun">== </span><span class="lit">10</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">all</span><span class="pun">!(</span><span class="pln">x </span><span class="pun">=&gt; </span><span class="pln">x </span><span class="pun">== -</span><span class="lit">1</span><span class="pun">));
    }

    {
        </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[])<wbr/>.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">8</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">length </span><span class="pun">== </span><span class="lit">8</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">get<wbr/></span><span class="pun">.</span><span class="pln">all</span><span class="pun">!(</span><span class="pln">x </span><span class="pun">=&gt; </span><span class="pln">x </span><span class="pun">== </span><span class="typ">long<wbr/></span><span class="pun">.</span><span class="pln">init</span><span class="pun">));
    }
}

</span><span class="com">//static array
</span><span class="pun">{
    </span><span class="kwd">import </span><span class="pln">std<wbr/></span><span class="pun">.</span><span class="pln">algorithm </span><span class="pun">: </span><span class="pln">all</span><span class="pun">;

    {
        </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[</span><span class="lit">4</span><span class="pun">])<wbr/>.</span><span class="pln">make</span><span class="pun">(-</span><span class="lit">1</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">get</span><span class="pun">[]<wbr/>.</span><span class="pln">all</span><span class="pun">!(</span><span class="pln">x </span><span class="pun">=&gt; </span><span class="pln">x </span><span class="pun">== -</span><span class="lit">1</span><span class="pun">));

    }

    {
        </span><span class="typ">long</span><span class="pun">[</span><span class="lit">4</span><span class="pun">] </span><span class="pln">tmp </span><span class="pun">= [</span><span class="lit">0</span><span class="pun">, </span><span class="lit">1</span><span class="pun">, </span><span class="lit">2</span><span class="pun">, </span><span class="lit">3</span><span class="pun">];
        </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[</span><span class="lit">4</span><span class="pun">])<wbr/>.</span><span class="pln">make</span><span class="pun">(</span><span class="pln">tmp</span><span class="pun">);
        </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">get</span><span class="pun">[] == </span><span class="pln">tmp</span><span class="pun">[]);
    }
}

</span></code></pre>
</section>
<section><h2>Example</h2>

<pre class="code"><code class="lang-d"><span class="com">//make RcPtr object
</span><span class="kwd">static struct </span><span class="typ">Foo</span><span class="pun">{
    </span><span class="typ">int </span><span class="pln">i</span><span class="pun">;

    </span><span class="kwd">this</span><span class="pun">(</span><span class="typ">int </span><span class="pln">i</span><span class="pun">)</span><span class="kwd">pure nothrow @safe @nogc</span><span class="pun">{
        </span><span class="kwd">this<wbr/></span><span class="pun">.</span><span class="pln">i </span><span class="pun">= </span><span class="pln">i</span><span class="pun">;
    }
}

{
    </span><span class="kwd">auto </span><span class="pln">foo </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Foo<wbr/></span><span class="pun">.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">42</span><span class="pun">);
    </span><span class="kwd">auto </span><span class="pln">foo2 </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!</span><span class="typ">Foo<wbr/></span><span class="pun">.</span><span class="pln">make</span><span class="pun">!</span><span class="typ">Mallocator</span><span class="pun">(</span><span class="lit">42</span><span class="pun">);  </span><span class="com">//explicit stateless allocator
</span><span class="pun">}

{
    </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[])<wbr/>.</span><span class="pln">make</span><span class="pun">(</span><span class="lit">10</span><span class="pun">); </span><span class="com">//dynamic array with length 10
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">length </span><span class="pun">== </span><span class="lit">10</span><span class="pun">);
}
</span></code></pre>
</section>
<section><h2>Example</h2>

<pre class="code"><code class="lang-d"><span class="com">//alloc RcPtr object
</span><span class="kwd">import </span><span class="pln">std<wbr/></span><span class="pun">.</span><span class="pln">experimental<wbr/></span><span class="pun">.</span><span class="pln">allocator </span><span class="pun">: <a href="../../autoptr/rc_ptr/RcPtr.make.html"></span><span class="pln">make</span></a><span class="pun">, </span><span class="pln">dispose</span><span class="pun">, </span><span class="pln">allocatorObject</span><span class="pun">;

</span><span class="kwd">auto </span><span class="pln">allocator </span><span class="pun">= </span><span class="pln">allocatorObject</span><span class="pun">(</span><span class="typ">Mallocator<wbr/></span><span class="pun">.</span><span class="pln">instance</span><span class="pun">);

{
    </span><span class="kwd">auto </span><span class="pln">x </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">)<wbr/>.</span><span class="pln">alloc</span><span class="pun">(</span><span class="pln">allocator</span><span class="pun">, </span><span class="lit">42</span><span class="pun">);
}

{
    </span><span class="kwd">auto </span><span class="pln">arr </span><span class="pun">= </span><span class="typ">RcPtr</span><span class="pun">!(</span><span class="typ">long</span><span class="pun">[])<wbr/>.</span><span class="pln">alloc</span><span class="pun">(</span><span class="pln">allocator</span><span class="pun">, </span><span class="lit">10</span><span class="pun">); </span><span class="com">//dynamic array with length 10
    </span><span class="kwd">assert</span><span class="pun">(</span><span class="pln">arr<wbr/></span><span class="pun">.</span><span class="pln">length </span><span class="pun">== </span><span class="lit">10</span><span class="pun">);
}

</span></code></pre>
</section>

			<footer>
				<table class="license-info">
					<tr>
						<th>Authors</th>
						<td>
							<p>github.com/submada/basic_string, Adam Búš
</p>

						</td>
					</tr>
					<tr>
						<th>Copyright</th>
						<td>
							
						</td>
					</tr>
					<tr>
						<th>License</th>
						<td>
							<p>www.boost.org/LICENSE_1_0.txt, Boost License 1.0.
</p>

						</td>
					</tr>
				</table>
				<p class="faint">Generated using the DDOX documentation generator</p>
			</footer>
		</div>
	</body>
</html>